import React, { Component } from 'react'
import PropTypes from 'prop-types'

export default class Test extends Component {
  static propTypes = {
    colors: PropTypes.array,
  }
  render() {
    return (
      <ul>
        {this.props.colors.map((item) => (
          <li key={item} style={{ backgroundColor: item }}>
            {item}
          </li>
        ))}
      </ul>
    )
  }
}

// 静态属性
/* Test.propTypes = {
  colors: PropTypes.array,
} */
